package com.shan;

import java.util.Scanner;

/**
 * @Author: ShanYuqing
 * @Version: v1.0
 */
public class GetScore {
    /*
            需求：在编程竞赛中，有6个评委为参赛选手进行打分，分数为0~100的整数分
            在选手的最后得分后，去掉一个最高分和一个最低分的四个评委平均值
     */
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入6个评委的打分");
        int[] arr = new int[6];
        for (int i = 0; i < arr.length; i++) {
            System.out.println("第" + (i + 1) + "的评委打的分数：");
            int score = sc.nextInt();
            if (score >= 0 && score <= 100) {
                arr[i] = score;
            } else {
                System.out.println("输入的分数不在区间内");
                i--;
            }
        }
        //计算最大值
        int sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i];
        }
        System.out.println("总分为：" + sum);
        int max = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
            }
        }
        System.out.println(max);
        //计算最小值
        int min = arr[0];
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] < min) {
                min = arr[i];
            }
        }
        System.out.println(min);
       //计算平均值
        double pingjun = (sum-max-min)/(arr.length-2)*1.0;
        System.out.println(pingjun);
    }


}


